package OrderService

import (
	"gdshop-back-end-go/common/libs/asynqQueue"
	"gdshop-back-end-go/common/libs/asynqQueueClient"
	"gdshop-back-end-go/common/request/TaskDataReq"
	"github.com/gogf/gf/encoding/gjson"
	"github.com/gogf/gf/frame/g"
)

// 关闭未支付订单
func AddCloseNoPayOrder(data TaskDataReq.CloseNoPayOrder) {
	json, err := gjson.Encode(data)
	if err != nil {
		return
	}
	_, err = asynqQueueClient.GetClient().Enqueue(
		asynqQueueClient.GetTask(asynqQueue.CloseNoPayOrder,
			json,
		))
	if err != nil {
		g.Log().Error("AddCloseNoPayOrder error ", err)
	}
}
